import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
// JSON.parse(window.sessionStorage.getItem('modueList') || '[]')
export default new Vuex.Store({
    state: {
        modueList: JSON.parse(window.sessionStorage.getItem("modueList")?window.sessionStorage.getItem("modueList"):'[]'),
        btus: window.sessionStorage.getItem('btus') == null ? "" : window.sessionStorage.getItem('btus'),
        userInfo:JSON.parse(window.sessionStorage.getItem('userInfo')),
        language:JSON.parse(window.sessionStorage.getItem('language')),
    },
    mutations: {
        setmodueList(start, data) {
            start.modueList = data
            sessionStorage.setItem('modueList', JSON.stringify(data))
        },
        setBtus(start, data) {
            start.btus = data
            sessionStorage.setItem('btus', data)
        },
        setUserInfo(start, data) {
            start.userInfo = data
            sessionStorage.setItem('userInfo', JSON.stringify(data))
        },
        setLanguage(start, data){
            start.language=data
            sessionStorage.setItem('language', JSON.stringify(data))
        }
    },
    actions: {},
    modules: {}
})
